home *** CD-ROM | disk | FTP | other *** search
- unit PG1;
-
- interface
-
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- StdCtrls;
-
- type
- TForm1 = class(TForm)
- Button1: TButton;
- procedure Button1Click(Sender: TObject);
- end;
-
- var
- Form1: TForm1;
-
- implementation
-
- {$R *.DFM}
-
- uses ComCtrls; // Supports the TProgressBar control
-
- procedure TestProgress(Form: TForm; Count: SmallInt);
- var
- ProgressBar1: TProgressBar;
- i: SmallInt;
- begin
- ProgressBar1 := TProgressBar.Create(Form);
- try
- ProgressBar1.Parent := Form;
- ProgressBar1.Align := alBottom;
- ProgressBar1.Min := 0;
- ProgressBar1.Max := Count;
- ProgressBar1.Step := 1; // the amount to move with the StepIt method
- for i := 1 to Count do
- ProgressBar1.Stepit; // Move one Step amount
- // Instead of StepIt, we could also
- // have coded: Position := i;
- ShowMessage('Now the ProgressBar control will be freed');
- finally
- ProgressBar1.Free;
- end;
- end;
-
- procedure TForm1.Button1Click(Sender: TObject);
- begin
- TestProgress(Self, 1000);
- end;
-
- end.
-